home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 August: Tool Chest / Apple_Developer_Group_August_1996_Tool_Chest.iso / Sample Code / Snippets / QuickDraw / MakeIcon / InitMac.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-15  |  1.2 KB  |  69 lines  |  [TEXT/KAHL]

  1. #include <GestaltEQU.h>
  2.  
  3. SysEnvRec    TheWorld;
  4. Boolean        WNE_available;
  5. Boolean        HasGWorlds;
  6. Boolean        HasCQD;
  7.  
  8. #define    _Unimplemented 0xA89F
  9. #define    _WaitNextEvent 0xA860
  10.  
  11. Boolean TrapAvailable ( tNum, tType)
  12. short        tNum;
  13. short    tType;
  14. {
  15.     return ( NGetTrapAddress(tNum,tType) != GetTrapAddress(_Unimplemented) );
  16. }
  17.  
  18. Boolean WNEIsImplemented()
  19. {
  20.     if (TheWorld.machineType < 0)
  21.     {
  22.         return FALSE;
  23.     }
  24.     else
  25.     {
  26.         return TrapAvailable ( _WaitNextEvent, ToolTrap);
  27.     }
  28. }
  29.  
  30.  
  31. void CheckQuickDraw ()
  32. {
  33.     long      qdVersion;  /* Version of QuickDraw on this machine */
  34.     /* Find out if GWorlds and CQD are implemented on this machine */
  35.     (void) Gestalt (gestaltQuickdrawVersion, &qdVersion);
  36.  
  37.     HasGWorlds = (qdVersion > gestaltOriginalQD && qdVersion < gestalt8BitQD)
  38.                   || qdVersion >= gestalt32BitQD;
  39.     
  40.     HasCQD = qdVersion >= gestalt8BitQD;
  41.  
  42. }
  43.  
  44.  
  45. InitToolBox(numberOfMasters)
  46. int            numberOfMasters;
  47. {
  48.     int index;
  49.     
  50.     InitGraf(&thePort);
  51.     InitFonts();
  52.     InitWindows();
  53.     InitMenus();
  54.     InitCursor();
  55.     TEInit();
  56.     FlushEvents(everyEvent, 0);
  57.     InitDialogs(NIL);
  58.     
  59.     while(numberOfMasters--)
  60.         MoreMasters();
  61.         
  62.     MaxApplZone();
  63.     SysEnvirons(1,&TheWorld);
  64.     WNE_available = WNEIsImplemented();
  65.  
  66.     CheckQuickDraw ();
  67.  
  68. }
  69.